package io.gitee.zhangbinhub.acp.boot.test

import io.gitee.zhangbinhub.acp.boot.log.LogAdapter
import io.gitee.zhangbinhub.acp.boot.websocket.servlet.AcpWebSocketClient
import org.springframework.web.socket.CloseStatus
import org.springframework.web.socket.WebSocketSession
import java.nio.ByteBuffer

class TestAcpWebSocketClientServlet(
    logAdapter: LogAdapter, clientId: String
) : AcpWebSocketClient(logAdapter, clientId) {
    override fun sessionOpen(session: WebSocketSession) {
        println("session open")
    }

    override fun sessionClose(session: WebSocketSession?, closeStatus: CloseStatus) {
        println("session close")
    }

    override fun sessionError(session: WebSocketSession?, throwable: Throwable?) {
        println("session error: ${throwable?.message}")
    }

    override fun receiveMessage(session: WebSocketSession, message: String) {
        println("收到消息：$message")
    }

    override fun receiveMessage(session: WebSocketSession, message: ByteBuffer) {
        println("收到消息：$message")
    }
}